package xyz.ddlnt.serviceusr.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import xyz.ddlnt.model.dto.MessageDTO;
import xyz.ddlnt.model.entity.Message;
import xyz.ddlnt.model.vo.MessageVO;
import xyz.ddlnt.serviceusr.mapper.MessageMapper;
import xyz.ddlnt.serviceusr.service.MessageService;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @author ZZULI_SE 210910
 * @data 2025/5/26 16:48
 */
@Slf4j
@Service
public class MessageServiceImpl extends ServiceImpl<MessageMapper, Message> implements MessageService {
    @Resource
    private MessageMapper messageMapper;

    @Override
    public List<MessageVO> getMessageList(MessageDTO messageDTO) {
        if (messageDTO.getTimeAnchorPoint() == null || messageDTO.getTimeAnchorPoint().equals("")) {
            messageDTO.setTimeAnchorPoint(LocalDateTime.now());
        }
        log.info(messageDTO.toString());
        return messageMapper.selectMessageList( messageDTO);
    }
}
